"""
.. module:: Dividend
    :platform: Unix, Windows
    :synopsis: This class represents dividend on an equity/stock product

.. moduleauthor:: Nick Leaton <nickle@gmail.com>

"""

from Entities.Products.Product import Product

class Dividend (Product):
    '''
    Dividend on an equity/stock product
    '''
    
    def __init__ (self, name, declaration_date, record_date, ex_dividend_date, pay_date, product, amount):
        '''
        A dividend on a stock
        :Parameters:
        - `name`:              Name of the dividend
        - `declaration_date`:  Date on which the dividend was declared
        - `record_date`:       If you hold the stock on this date you are entitled to the dividend
        - `ex_dividend_date`:  Date on which you have to buy to hold the stock on the record date.  
        - `pay_date`:          Date on which the dividend is paid 
        - `product`:           What is delivered on the pay_date. Typically the currency of the stock
        - `amount`:            The quantity of product paid per unit of stock held.        
        '''
        Product.__init__(self, name)
        self.declaration_date = declaration_date
        self.record_date      = record_date
        self.ex_dividend_date = ex_dividend_date
        self.pay_date         = pay_date
        self.product          = product
        self.amount           = amount
        
    def __repr__ (self):
        '''
        Representation of dividend
        '''
        return "<Dividend(%s,%s,%s,%s,%s,%s,%f)>" % \
            (
            self.name,
            self.declaration_date,
            self.record_date,
            self.ex_dividend_date,
            self.pay_date,
            self.product.name,
            self.amount
            )